﻿using Smobiler.Core;
using Smobiler.Core.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FubiManger.Controls
{
    ////ToolboxItem用于控制是否添加自定义控件到工具箱，true添加，false不添加
    //[System.ComponentModel.ToolboxItem(true)]
    partial class calendcontrol : Smobiler.Core.Controls.MobileUserControl
    {
        public calendcontrol() : base()
        {
            //This call is required by the SmobilerUserControl.
            InitializeComponent();
        }
        string week { get; set; }
        public string days { get; set; }
        private void calendcontrol_Load(object sender, EventArgs e)
        {
            Dayofweek();
            lblyear.Text = calend.SelectDate.Year.ToString() + "年";
            lbldate.Text = calend.SelectDate.Month.ToString() + "月" + calend.SelectDate.Day.ToString() + "日" + week;
        }
        private void Dayofweek()
        {
            switch (calend.SelectDate.DayOfWeek.ToString())
            {
                case "Monday":
                    week = "周一";
                    break;
                case "Tuesday":
                    week = "周二";
                    break;
                case "Wednesday":
                    week = "周三";
                    break;
                case "Thursday":
                    week = "周四";
                    break;
                case "Friday":
                    week = "周五";
                    break;
                case "Saturday":
                    week = "周六";
                    break;
                case "Sunday":
                    week = "周日";
                    break;
            }
        }

        private void calend_DateChanged(object sender, EventArgs e)
        {
            Dayofweek();
            lblyear.Text = calend.SelectDate.Year.ToString() + "年";
            lbldate.Text = calend.SelectDate.Month.ToString() + "月" + calend.SelectDate.Day.ToString() + "日" + week;
        }

        private void btnclose_Press(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnok_Press(object sender, EventArgs e)
        {
            days = calend.SelectDate.Year.ToString() + "/" + calend.SelectDate.Month.ToString() + "/" + calend.SelectDate.Day.ToString();
            this.Close();
        }
    }
}